package com.eastfair.venueservice.enumeration;

import com.eastfair.annotation.base.BaseEnum;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 押金预警
 * </p>
 *
 * @author linan
 * @date 2023-02-17
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "DepositWarningWarningStandardJudgeEnum", description = "预警标准判断 #{GREATER_THAN:大于;EQUAL:等于;GREATER_THAN_OR_EQUAL:大于或等于;-枚举")
public enum DepositWarningWarningStandardJudgeEnum implements BaseEnum {

    /**
     * GREATER_THAN="大于"
     */
    GREATER_THAN("大于"),
    /**
     * EQUAL="等于"
     */
    EQUAL("等于"),
    /**
     * GREATER_THAN_OR_EQUAL="大于或等于"
     */
    GREATER_THAN_OR_EQUAL("大于或等于"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static DepositWarningWarningStandardJudgeEnum match(String val, DepositWarningWarningStandardJudgeEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static DepositWarningWarningStandardJudgeEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(DepositWarningWarningStandardJudgeEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "GREATER_THAN,EQUAL,GREATER_THAN_OR_EQUAL", example = "GREATER_THAN")
    public String getCode() {
        return this.name();
    }

}
